package cn.kpi.service.common.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.kpi.dao.common.OrgSummaryDao;
import cn.kpi.service.common.IOrgSummaryService;

@Service
public class OrgSummaryServiceImpl implements IOrgSummaryService {
    @Autowired
    private OrgSummaryDao orgSummaryDao;

    public List<Map> GetOrgSummaryList(String where, int year, int month, String status, int currentmonth) throws Exception {
        try {
            return orgSummaryDao.GetOrgSummaryList(where, year, month, status, currentmonth);
        } catch (Exception ex) {
            ex.printStackTrace();
            return null;
        }
    }

    public List<Map> GetOrgSummaryListPDF(String where, int year, int month, String status, int currentmonth) throws Exception {
        try {
            return orgSummaryDao.GetOrgSummaryListPDF(where, year, month, status, currentmonth);
        } catch (Exception ex) {
            ex.printStackTrace();
            return null;
        }
    }

    @Override
    public List<Map> GetOrgSummaryTranList(String where, int year, int month, String status, int currentmonth) throws Exception {
        try {
            return orgSummaryDao.GetOrgSummaryTranList(where, year, month, status, currentmonth);
        } catch (Exception ex) {
            ex.printStackTrace();
            return null;
        }
    }

    @Override
    public List<Map> GetOrgSummaryWorkList(String where, int year, int month, String status, int currentmonth) throws Exception {
        try {
            return orgSummaryDao.GetOrgSummaryWorkList(where, year, month, status, currentmonth);
        } catch (Exception ex) {
            ex.printStackTrace();
            return null;
        }
    }

    @Override
    public List<Map> GetOrgSummaryDeptSubList(String where, int year, int month, String status, int currentmonth) throws Exception {
        try {
            return orgSummaryDao.GetOrgSummaryDeptSubList(where, year, month, status, currentmonth);
        } catch (Exception ex) {
            ex.printStackTrace();
            return null;
        }
    }

    @Override
    public List<Map> GetOrgSummaryWorkListPDF(int year, int quarter, int orgid) throws Exception {
        return orgSummaryDao.GetOrgSummaryWorkListPDF(year,quarter,orgid);
    }


    public int GetExitOrgSummary(Long orgid, int year, int month, String type) throws Exception {
        try {
            return orgSummaryDao.GetExitOrgSummary(orgid, year, month, type);
        } catch (Exception ex) {
            ex.printStackTrace();
            return -1;
        }
    }

    @Override
    public int GetExitOrgStatusSummary(Long orgid, int year, int month, String type, String status) throws Exception {
        try {
            return orgSummaryDao.GetExitOrgStatusSummary(orgid, year, month, type, status);
        } catch (Exception ex) {
            ex.printStackTrace();
            return -1;
        }
    }

    public int InsertOrgYearBacth(List<Integer> list, int year) throws Exception {
        try {
            return orgSummaryDao.InsertOrgYearBacth(list, year);
        } catch (Exception ex) {
            ex.printStackTrace();
            return -1;
        }
    }

    @Override
    public int InsertOrgYearTranBacth(List<Integer> list, int year) throws Exception {
        try {
            return orgSummaryDao.InsertOrgYearTranBacth(list, year);
        } catch (Exception ex) {
            ex.printStackTrace();
            return -1;
        }
    }

    @Override
    public int InsertOrgYearWorkBacth(List<Integer> list, int year) throws Exception {
        try {
            return orgSummaryDao.InsertOrgYearWorkBacth(list, year);
        } catch (Exception ex) {
            ex.printStackTrace();
            return -1;
        }
    }

    @Override
    public int InsertOrgYearDeptSubBacth(List<Integer> list, int year) throws Exception {
        try {
            return orgSummaryDao.InsertOrgYearDeptSubBacth(list, year);
        } catch (Exception ex) {
            ex.printStackTrace();
            return -1;
        }
    }

    public int GetOrgYearCount(String temptype, int year, int month) throws Exception {
        try {
            return orgSummaryDao.GetOrgYearCount(temptype, year, month);
        } catch (Exception ex) {
            ex.printStackTrace();
            return -1;
        }
    }
}
